package com.wyp168.leetcode;

/**
 * @ClassName CanBeEqual
 * @Description TODO
 * @Author wyp168
 * @Date 2022/8/24 08:27
 */
public class CanBeEqualSolution {
    public static void main(String[] args) {
        int[] target = {7};
        int[] arr = {7};

        CanBeEqualSolution canBeEqualSolution = new CanBeEqualSolution();
        System.out.println(canBeEqualSolution.canBeEqual(target, arr));
    }

    public boolean canBeEqual(int[] target, int[] arr) {
        int[] countNum = new int[1000];
        int removeCount = 0;
        for (int arrItem : arr) {
            countNum[arrItem - 1] ++;
        }

        for (int targetItem : target) {
            if (countNum[targetItem - 1] != 0) {
                countNum[targetItem - 1] --;
                removeCount ++;
            }
        }
        return removeCount == arr.length;
    }
}
